<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form>
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexProtocolo.xhtml')}" value="Protocolo" update="@form" immediate="true"/> >
                    <p:commandLink  value="Pesquisar" update="@form" immediate="true"/>
                </div>
            </h:form>
            <p:panel header="Selo não Usado">
                <h:form id="buscar_formSelo" acceptcharset="utf-8"> 

                    <p:messages showDetail="true"  id="msg"/> 
                    <h:panelGrid columns="2" id="panel"  styleClass="textAlignRight" columnClasses="textAlignRight"> 
                        
                        <h:outputLabel value="Serie : " />
                        <p:inputText  value="#{managerRelatorioSelo.selo.serie}" size="35" />
                        
                        <h:outputLabel value="Número : " />
                        <p:row>
                            <p:inputText  value="#{managerRelatorioSelo.numIni}" size="15" />                        
                            <h:outputLabel value=" a  " style="float: none;" />
                            <p:inputText  value="#{managerRelatorioSelo.numFim}" size="15" />
                        </p:row>
                        
                        <h:outputLabel value="Tipo Selo :"/>
                        <p:autoComplete id="tipoSelo" panelStyle="width:250px !important;" effect="blind" 
                                        value="#{managerRelatorioSelo.selo.tipoSelo}" 
                                        completeMethod="#{managerTipoSelo.completeTipoSelo}"  
                                        var="p" itemLabel="#{p.nome}" itemValue="#{p}" 
                                        converter="tipoSeloConverter" forceSelection="true" 
                                        converterMessage="Erro, verifique o Tipo Selo" 
                                        minQueryLength="3" dropdown="true" size="31" scrollHeight="200"> 
                            <p:ajax event="itemSelect" listener="#{managerRelatorioSelo.handleSelectTipo}"/>
                            <p:column> 
                                <table >
                                    <tr style="height:20px; background-color: \##{p.corSelo.cor};">
                                        <td style="width: 20px;"></td>
                                    </tr>
                                </table>
                            </p:column>
                            <p:column>  
                                #{p.nome}
                            </p:column>  
                        </p:autoComplete>
                        <h:outputText value="Recebedor :"/>
                            <p:autoComplete id="usuario" panelStyle="width:250px !important;" 
                                            effect="blind" 
                                            value="#{managerRelatorioSelo.distribuicao.recebedor}"
                                            completeMethod="#{managerUsuario.completeUsuario}"  
                                            var="p" itemLabel="#{p.nome}" itemValue="#{p}"
                                            converter="usuarioConverter" forceSelection="true" 
                                            converterMessage="Erro, verifique o Fornecedor" 
                                            minQueryLength="3" dropdown="true"> 
                                <p:ajax event="itemSelect" listener="#{managerRelatorioSelo.handleSelect}"/>                                        
                            </p:autoComplete>
                    </h:panelGrid>
                    <div class="buttonAction">
                        <p:commandButton value="Relatório" 
                                         actionListener="#{managerRelatorioSelo.relatorio()}" 
                                         update="@form" ajax="false" process="@form" 
                                         onclick="this.form.target='_blank'"
                                         icon="ui-icon-search"/>

<!--                                         onclick="statusDialog.show();" 
                                         oncomplete="statusDialog.hide();"-->
                        
                        <p:commandButton value="Limpar" icon="ui-icon-circle-close" 
                                         actionListener="#{managerRelatorioSelo.clean()}"
                                         update="@form"/>
                    </div>
                    <p:dialog modal="true" widgetVar="statusDialog" header="Gerando Relatório"   
                          draggable="false" closable="false">  
                        <p:graphicImage value="/media/img/ajaxloadingbar.gif" />  
                    </p:dialog>
                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>